﻿/*
 * Author: Mattan360
 * Contributors:
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using Irrlicht.Net.Video;

namespace Irrlicht.Net.GUI
{
    public sealed class StaticText : Element
    {
        #region PInvoke
        /*[DllImport("IrrlichtW.dll", CallingConvention = CallingConvention.Cdecl)]
        internal static extern void stxtSetText(IntPtr stxt,
            [MarshalAs(UnmanagedType.BStr)]
            string text);
        [DllImport("IrrlichtW.dll", CallingConvention = CallingConvention.Cdecl)]
        internal static extern string stxtGetText(IntPtr stxt);*/

        [DllImport("IrrlichtW.dll", CallingConvention = CallingConvention.Cdecl)]
        internal static extern void stxt_GetOverrideColor(IntPtr stxt, ref uint a, ref uint r, ref uint g, ref uint b);
        [DllImport("IrrlichtW.dll", CallingConvention = CallingConvention.Cdecl)]
        internal static extern void stxt_SetOverrideColor(IntPtr stxt, uint a, uint r, uint g, uint b);
        #endregion

        // Implemented in base class
        /*public string Text
        {
            get
            {
                return stxtGetText(pointer);
            }

            set
            {
                stxtSetText(pointer, value);
            }
        }*/

        internal static StaticText CreateStaticText(IntPtr pointer)
        {
            StaticText stxt = new StaticText();
            stxt.pointer = pointer;
            return stxt;
        }

        public Color OverrideColor
        {
            get
            {
                uint a = 0, r = 0, g = 0, b = 0;
                stxt_GetOverrideColor(pointer, ref a, ref r, ref g, ref b);
                return new Color(a, r, g, b);
            }

            set
            {
                stxt_SetOverrideColor(pointer, value.Alpha, value.Red, value.Green, value.Blue);
            }
        }
    }
}
